import ajax from '../utils/axios';
// 供应商接口
export async function getSupplierList(params){
  const res=await ajax.get(`/supplier`, {params});
  return res.data.data;
}

export async function getSupplierDetail(id){
  const res=await ajax.get(`/supplier/${id}`);
  return res.data.data;
}

export async function createSupplier(params){
  // interface params {
  //   address:      string;
  //   bank_card:    string;
  //   bank_id:      number;
  //   name:         string;
  //   phone_number: string;
  // }
  const res=await ajax.post(`/supplier`,params);
  return res.data.data;
}

export async function editSupplier(id,params){
   // interface params {
  //   address:      string;
  //   bank_card:    string;
  //   bank_id:      number;
  //   name:         string;
  //   phone_number: string;
  // }
  const res=await ajax.put(`/supplier/${id}`, params);
  return res.data.data;
}

export async function delSupplier(id){
  const res=await ajax.delete(`/supplier/${id}`);
  return res.data.data;
}

export async function batchDelSupplier(id_list){
  const res=await ajax.delete(`/supplier/batch_delete`, id_list);
  return res.data.data;
}